/*
 * Copyright (c) 2009, Servoy-stuff
 * 
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 * http://www.fsf.org/licensing/licenses/lgpl.txt
 */
package net.stuff.servoy.beans.slider;

import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.util.ArrayList;
import java.util.List;

import com.servoy.j2db.dataui.PropertyEditorClass;
import com.servoy.j2db.dataui.PropertyEditorHint;
import com.servoy.j2db.util.Debug;

/**
 * 
 * @author Servoy Stuff
 * http://www.servoy-stuff.net/
 */
public class ServoySliderBeanInfo extends SimpleBeanInfo {
	
	/* (non-Javadoc)
	 * @see java.beans.SimpleBeanInfo#getPropertyDescriptors()
	 */
	@Override
	public PropertyDescriptor[] getPropertyDescriptors() {
		try {
	    	List<PropertyDescriptor> liste = new ArrayList<PropertyDescriptor>();
	    	liste.add(new PropertyDescriptor("background", ServoySlider.class));
	    	PropertyDescriptor pd = new PropertyDescriptor("border", ServoySlider.class);
        	pd.setDisplayName("borderType");
        	liste.add(pd);
	    	pd = new PropertyDescriptor("font", ServoySlider.class);
        	pd.setDisplayName("fontType");
        	liste.add(pd);
	    	liste.add(new PropertyDescriptor("focusable", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("foreground", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("inverted", ServoySlider.class));
	    	pd = new PropertyDescriptor("majorTicks", ServoySlider.class);
	    	pd.setDisplayName("majorTickSpacing");
	    	liste.add(pd);
	    	pd = new PropertyDescriptor("maximumValue", ServoySlider.class);
	    	pd.setDisplayName("maximum");
	    	liste.add(pd);
	    	pd = new PropertyDescriptor("minimumValue", ServoySlider.class);
	    	pd.setDisplayName("minimum");
	    	liste.add(pd);
	    	pd = new PropertyDescriptor("minorTicks", ServoySlider.class);
	    	pd.setDisplayName("minorTickSpacing");
	    	liste.add(pd);
	    	pd = new PropertyDescriptor("currentValue", ServoySlider.class);
	    	pd.setDisplayName("value");
	    	liste.add(pd);
	    	liste.add(new PropertyDescriptor("opaque", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("orientation", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("paintLabels", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("paintTicks", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("paintTrack", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("snapToTicks", ServoySlider.class));
	    	pd = new PropertyDescriptor("toolTipMessage", ServoySlider.class);
	    	pd.setDisplayName("toolTipText");
	    	liste.add(pd);
	    	liste.add(new PropertyDescriptor("location", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("name", ServoySlider.class));
	    	liste.add(new PropertyDescriptor("size", ServoySlider.class));
	    	
	    	liste.add(new PropertyDescriptor("usingDecimals", ServoySlider.class));
	    	pd = new PropertyDescriptor("precision", ServoySlider.class);
	    	pd.setDisplayName("precisionFactor");
	    	liste.add(pd);
	    	pd = new PropertyDescriptor("webStyleType", ServoySlider.class);
	    	pd.setPropertyEditorClass(WebStyleTypePropertyEditor.class);
	    	liste.add(pd);
	    	
	    	pd = new PropertyDescriptor("dataProviderID", ServoySlider.class);
			PropertyEditorHint dpHint = new PropertyEditorHint(PropertyEditorClass.dataprovider);
			pd.setValue(PropertyEditorHint.PROPERTY_EDITOR_HINT, dpHint);
			liste.add(pd);
			
			pd = new PropertyDescriptor("onDataChange", ServoySlider.class);
			dpHint = new PropertyEditorHint(PropertyEditorClass.method);
			pd.setValue(PropertyEditorHint.PROPERTY_EDITOR_HINT, dpHint);
			liste.add(pd);
	    	
	    	PropertyDescriptor propdescriptors[] = liste.toArray(new PropertyDescriptor[0]);
	        return propdescriptors;
		}
	    catch(Exception e)
	    {
	        Debug.error((new StringBuilder()).append("ServoySliderBeanInfo: unexpected exception: ").append(e).toString(), e);
	    }
	    return null;
	}

}
